﻿using Bigway.Common.Models.DbModels;
using SqlSugar;

namespace Benefactor.Models.DbModels;

public class Voucher: DeletableEntity
{
    [SugarColumn(IsNullable = false)]
    public string BenefitId { get; set; }

    [SugarColumn(IsNullable = false)]
    public string Name { get; set; }

    [SugarColumn(IsNullable = false)]
    public string MerchantId { get; set; }

    [SugarColumn(IsNullable = false)]
    public string ProductId { get; set; }

    [SugarColumn(IsNullable = false)]
    public string UserId { get; set; }

    [SugarColumn(IsNullable = true)]
    public string? DistrictId { get; set; }

    [SugarColumn(IsNullable = false)]
    public string BenefitsCardId { get; set; }

    [SugarColumn(IsNullable = false)]
    public string IssuedBenefitsCardId { get; set; }

    [SugarColumn(IsNullable = false)]
    public string IssuedBenefitsCardNo { get; set; }

    [SugarColumn(IsNullable = false)]
    public DateOnly ValidFrom { get; set; }

    [SugarColumn(IsNullable = false)]
    public DateOnly ValidTo { get; set; }

    [SugarColumn(IsNullable = false)]
    public string ConsumeCode { get; set; }

    [SugarColumn(IsNullable = false)]
    public bool IsUsed { get; set; }

    [SugarColumn(IsNullable = true)]
    public DateTime? UseTime { get; set; }

    [Navigate(NavigateType.OneToOne, nameof(IssuedBenefitsCardId))]
    public IssuedBenefitsCard? IssuedBenefitsCard { get; set; }

    [Navigate(NavigateType.OneToOne, nameof(BenefitsCardId))]
    public BenefitsCard? BenefitsCard { get; set; }

    [Navigate(NavigateType.OneToOne, nameof(BenefitId))]
    public Benefit? Benefit { get; set; }

    [Navigate(NavigateType.OneToOne, nameof(ProductId))]
    public Product? Product { get; set; }
}